var FireDrop = {
	
	onLoad: function() {
		// initialization code
		this.initialized = true;
		
		var contextMenu = document.getElementById("contentAreaContextMenu");  
		if (contextMenu){
			contextMenu.addEventListener("popupshowing", this.uploadMenuShowHideItems, false);
		}
	},
	
	uploadMenuShowHideItems: function() {
		var show = document.getElementById("upload-file");  
		show.hidden = !(gContextMenu.onImage || gContextMenu.onLink);
	
	},
	
	getFolderContentCallback: function(data){
		alert(data);
	},
	
	onMenuItemCommand: function() {
		//alert("FireDrop!!");
		//params = [];
		//window.openDialog("chrome://firedrop/content/dropboxlogin.xul", "", "chrome", params);
		dropbox.setup();
		//dropbox.login("peluja1012@gmail.com","petepeter",dropbox.consumerKey,dropbox.consumerSecret);
		//dropbox.getFolderContents("/",this.getFolderContentCallback);
		//window.openDialog("chrome://pagesummary/content/displaySummary.xul", "", "chrome", params);
	},
	
	
	uploadFile: function() {
		var printFolder = function printFolder(data){
			alert(data);
		};
		dropbox.getFolderContents("Photos", printFolder);
	
		/*
		alert("Uploading File: "+gContextMenu.linkURL);
		$.ajax({
		        url: gContextMenu.linkURL,
		        //dataType: "json",
		        type: "GET",
				//async: true,
				//global : false,
				//timeout: 5000,
		        complete: function(){
					alert("complete");
		        	console.log("complete");
		        },
		        success: function(data, status){
					alert(data);
				},
		        error: function(XHR, textStatus, errorThrown){
					alert(XHR.responseText);
		        }
		    });*/
	
	}
	
	
};

window.addEventListener("load", function(e) { FireDrop.onLoad(e); }, false); 